Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

deVBuffer_priv.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file deVBuffer_priv.hpp
00003 ///
00004 /// @brief Private vertex buffer implementation header
00005 ///
00006 /// @author Assassin
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date May 2002
00023 /// @author Assassin
00024 /// @remarks Creation
00025 ///
00026 ///////////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef DEVBUFFER_PRIV_HPP
00029 #define DEVBUFFER_PRIV_HPP
00030 
00031 #include "deList.hpp"
00032 #include "deDriver.hpp"
00033 
00034 class deVertexBuffer;
00035 class deSubVertexBuffer;
00036 
00037 long IdeVertexBuffer_EntrySize(IdeVertexBuffer::BufferType Type);
00038 IdeVertexBuffer::BufferDataType IdeVertexBuffer_FillBufferDataType(IdeVertexBuffer::BufferType Type, long *Size);
00039 
00040 typedef struct DriverBufferEntry
00041 {
00042     long ID;                //id of the driver
00043     long UpdateList;        //list of buffers that have changed since the last update
00044     void *Buffer;           //a pointer to data the driver wants to store
00045     IdeDriver * Driver;     // a pointer to the driver so that the buffer can be properly freed
00046 } DriverBufferEntry;
00047 
00048 class deVertexBuffer : public IdeVertexBuffer, public deRefCountBase
00049 {
00050     //constructor and destructor
00051 protected:
00052     ~deVertexBuffer();
00053 public:
00054     deVertexBuffer();
00055 
00056     //copy constructors
00057     deVertexBuffer(const IdeVertexBuffer &S);
00058     const IdeVertexBuffer& operator=(const IdeVertexBuffer &S);
00059 
00060     //buffer information
00061     void *GetBuffer(BufferType Type) const;
00062 
00063     //vertex information
00064     long GetVertexCount() const;
00065     long GetVertexStart() const;
00066 
00067     //index information
00068     long GetIndexCount() const;
00069     long GetIndexStart() const;
00070 
00071     //tri information
00072     long GetTriCount() const;
00073     deBoolean CalcTriCount();
00074 
00075     //static/dynamic information
00076     deBoolean GetDynamicStatusVertex() const;
00077     deBoolean GetDynamicStatusIndex() const;
00078     void SetDynamicStatus(deBoolean Vertex, deBoolean Index);
00079 
00080     //type of rendering we are doing
00081     RenderType GetRenderType() const;
00082     deBoolean SetRenderType(RenderType Type);
00083 
00084     //buffer functions
00085     deBoolean SetBufferSize(long EntryCount, deBoolean IndicesNotVertices = deFALSE);
00086     deBoolean CreateBuffer(BufferType Type, deBoolean Clear);
00087     deBoolean DestroyBuffer(BufferType Type);
00088     deBoolean FillBuffer(BufferType Type, const void *Buffer, long StartEntry, long EntryCount);
00089     void DirtyBuffer(BufferType Type);
00090     void DirtyBuffer(BufferType Type, deSubVertexBuffer* SubVBCaller);
00091     deBoolean BufferExists(BufferType Type) const;
00092 
00093     //for doing separate index and data buffers
00094     deBoolean BindDataBuffer(IdeVertexBuffer* DataBuffer);
00095     IdeVertexBuffer* GetBoundDataBuffer() const;
00096 
00097     //a function to obtain the buffer data type
00098     BufferDataType GetBufferDataType(BufferType Type, long *Size) const;
00099 
00100     //lock/unlock functions
00101     deBoolean Lock();
00102     deBoolean Unlock();
00103 
00104     //functions for the driver class to tell the vertex class of info to store
00105     deBoolean SetDriverBuffer(long ID, void *Buffer, IdeDriver * Driver);
00106     void *GetDriverBuffer(long ID, long *BufferUpdateList) const;
00107 
00108     //functions that affect the shader function applied to this vertex buffer
00109     deBoolean AddVertexShader(void *ShaderData, long ShaderSize);
00110     void * GetVertexShader(long *ShaderSize) const;
00111     deBoolean DestroyVertexShader();
00112 
00113     VBufferType GetVBufferType() const;
00114     IdeVertexBuffer* GetParentBuffer() const;
00115 
00116     // vbuffer-only interface
00117 public:
00118     deBoolean AddSubVBuffer(deSubVertexBuffer * SubVB);
00119     deBoolean RemoveSubVBuffer(deSubVertexBuffer * SubVB);
00120     deBoolean AllocateVertexSpace(deSubVertexBuffer* SubVB, long Length, long &StartVertex, deBoolean resize = deFALSE);
00121     deBoolean AllocateIndexSpace(deSubVertexBuffer* SubVB, long Length, long &StartIndex, deBoolean resize = deFALSE);
00122 
00123 private:
00124     //private functions
00125     void CopyInternalData(const deVertexBuffer &SourceVertexBuffer);
00126     
00127     //lock info
00128     long    m_Locked;   //a flag to know if we are "locked" by someone else or not
00129 
00130     //buffer info
00131     IdeVertexBuffer*m_DataBuffer;                   //optional pointer to buffer that holds data streams
00132     void *          m_Buffer[BUFFER_COUNT];         //array of pointers to buffers
00133     deBoolean       m_WantsBuffer[BUFFER_COUNT];    //which buffers are needed
00134     long            m_VertexCount;                  //number of items per array
00135     long            m_IndexCount;
00136     long            m_TriCount;                     //number of tris the buffer holds info about
00137     RenderType      m_RenderType;                   //type of rendering to do
00138     deBoolean       m_DynamicVertex;
00139     deBoolean       m_DynamicIndex;
00140 
00141     //driver buffer information
00142     deTList <DriverBufferEntry> m_DriverBuffer;     //info that drivers can store
00143 
00144     // items for keeping track of sub-vbuffers
00145     long            m_UnusedVertices;
00146     long            m_UnusedIndices;
00147     deBoolean       m_HasChildren;
00148     deTList <deSubVertexBuffer*> m_ChildBuffers;
00149     deTList <deSubVertexBuffer*> m_IndexUsers;
00150     deTList <deSubVertexBuffer*> m_VertexUsers;
00151 };
00152 
00153 class deSubVertexBuffer : public IdeVertexBuffer, public deRefCountBase
00154 {
00155     //constructor and destructor
00156 protected:
00157     ~deSubVertexBuffer();
00158 public:
00159     deSubVertexBuffer(deVertexBuffer * Composite);
00160 
00161     //copy constructors
00162     deSubVertexBuffer(const IdeVertexBuffer &S);
00163     const IdeVertexBuffer& operator=(const IdeVertexBuffer &S);
00164 
00165     //buffer information
00166     void *GetBuffer(BufferType Type) const;
00167 
00168     //vertex information
00169     long GetVertexCount() const;
00170     long GetVertexStart() const;
00171 
00172     //index information
00173     long GetIndexCount() const;
00174     long GetIndexStart() const;
00175 
00176     //tri information
00177     long GetTriCount() const;
00178     deBoolean CalcTriCount();
00179 
00180     //static/dynamic information
00181     deBoolean GetDynamicStatusVertex() const;
00182     deBoolean GetDynamicStatusIndex() const;
00183     void SetDynamicStatus(deBoolean Vertex, deBoolean Index);
00184 
00185     //type of rendering we are doing
00186     RenderType GetRenderType() const;
00187     deBoolean SetRenderType(RenderType Type);
00188 
00189     //buffer functions
00190     deBoolean SetBufferSize(long EntryCount, deBoolean IndicesNotVertices = deFALSE);
00191     deBoolean CreateBuffer(BufferType Type, deBoolean Clear);
00192     deBoolean DestroyBuffer(BufferType Type);
00193     deBoolean FillBuffer(BufferType Type, const void *Buffer, long StartEntry, long EntryCount);
00194     void DirtyBuffer(BufferType Type);
00195     deBoolean BufferExists(BufferType Type) const;
00196 
00197     //for doing separate index and data buffers
00198     deBoolean BindDataBuffer(IdeVertexBuffer* DataBuffer);
00199     IdeVertexBuffer* GetBoundDataBuffer() const;
00200     
00201     //a function to obtain the buffer data type
00202     BufferDataType GetBufferDataType(BufferType Type, long *Size) const;
00203 
00204     //lock/unlock functions
00205     deBoolean Lock();
00206     deBoolean Unlock();
00207 
00208     //functions for the driver class to tell the vertex class of info to store
00209     deBoolean SetDriverBuffer(long ID, void *Buffer, IdeDriver * Driver);
00210     void *GetDriverBuffer(long ID, long *BufferUpdateList) const;
00211 
00212     //functions that affect the shader function applied to this vertex buffer
00213     deBoolean AddVertexShader(void *ShaderData, long ShaderSize);
00214     void * GetVertexShader(long *ShaderSize) const;
00215     deBoolean DestroyVertexShader();
00216 
00217     VBufferType GetVBufferType() const;
00218     IdeVertexBuffer* GetParentBuffer() const;
00219 
00220     // vbuffer-only interface
00221 public:
00222     void SetVertexStart(long Start);
00223     void SetIndexStart(long Start);
00224     void*GetVertexEntry();
00225     void*GetIndexEntry();
00226     void*GetListEntry();
00227     void SetVertexEntry(void* Entry);
00228     void SetIndexEntry(void* Entry);
00229     void SetListEntry(void* Entry);
00230     
00231 private:
00232     //private functions
00233     void CopyInternalData(const deVertexBuffer &SourceVertexBuffer);
00234     
00235     //lock info
00236     long            m_Locked;   //a flag to know if we are "locked" by someone else or not
00237 
00238     //buffer info
00239     IdeVertexBuffer*m_DataBuffer;                   //optional pointer to buffer that holds data streams
00240 //  deBoolean       m_WantsBuffer[BUFFER_COUNT];    //which buffers are needed
00241     long            m_VertexCount;                  //number of items per array
00242     long            m_IndexCount;
00243     long            m_TriCount;                     //number of tris the buffer holds info about
00244     RenderType      m_RenderType;                   //type of rendering to do
00245 
00246     //driver buffer information
00247     deTList <DriverBufferEntry> m_DriverBuffer;     //info that drivers can store
00248 
00249     // real/sub-vbuffer linkage
00250     deVertexBuffer* m_CompositeBuffer;
00251     long            m_CompositeVertexStart;
00252     long            m_CompositeIndexStart;
00253     void*           m_VertexEntry;
00254     void*           m_IndexEntry;
00255     void*           m_ListEntry;
00256 };
00257 
00258 #endif

Generated on Mon Sep 12 19:58:40 2005 for Destiny3D by doxygen1.3-rc3